package problem48;

//48.旋转图形
//https://leetcode.cn/problems/rotate-image/?envType=study-plan-v2&envId=top-interview-150

class Solution {
    public void rotate(int[][] matrix) {
        int n = matrix.length;
        int m = matrix[0].length;
        for(int i = 0; i<n/2; i++) {
            for(int j = 0; j<m; j++) {
                System.out.println(matrix[i][j] + " " + matrix[n-i-1][j]);
                int t = matrix[i][j];
                matrix[i][j] = matrix[n-i-1][j];
                matrix[n-i-1][j] = t;
            }
        }

        for(int i = 0; i<n; i++) {
            for(int j = 0; j<i; j++) {
                int t = matrix[i][j];
                matrix[i][j] = matrix[j][i];
                matrix[j][i] = t;
            }
        }
    }
}